# coding=UTF-8
import os,sys
from PIL import Image

def showImage(wt, img_width, img_height):
    str1 = []
    for i in range(0, len(wt), 2):
        # 以每2位为一组二进制，转换为十六进制
        str1.append(int(wt[i:i + 2], 16))
    img_out = Image.new("RGB", (img_width , img_height ))
    flag = 0
    for m in range(0, img_width):
        for n in range(0, img_height):
            if flag == len(str1):
                break
            img_out.putpixel((m, n), (str1[flag], str1[flag + 1], str1[flag + 2]))
            flag += 3
        if flag == len(str1):
            break
    img_out.save("e:\\mms\\加密水印图片.bmp")